package com.foreveross.proxyip.infra.conf.proxyip;

import java.io.IOException;
import java.util.Properties;

import com.foreveross.proxyip.infra.conf.ConfigContainer;
import com.foreveross.proxyip.infra.conf.ConfigLocalLoader;
import com.foreveross.proxyip.infra.conf.PropertiesConfigLocalLoader;



public class ProxyIpPropertiesLoader extends PropertiesConfigLocalLoader implements ConfigLocalLoader{

	public final static String CONFIG_FILE = "proxyIpService.properties";

	public String getFileName() {
		return CONFIG_FILE;
	}
	@Override
	public void load(){
		prop = null;
		try {
			prop = new Properties();
			prop.load(this.getClass().getClassLoader().getResourceAsStream(this.getFileName()));
		} catch (IOException e) {
			e.printStackTrace();
			logger.error(String.format("加载配件文件[%s]出错!", this.getFileName()), e);
		}
		if(prop != null) ConfigContainer.getInstance().registerCache(this.getFileName(), prop);
		
		this.setHasLoad(true);
	}
}
